package 每日一题;

import java.util.Comparator;
import java.util.TreeMap;

/**
 * @author chenhong
 * @version 1.0
 * @description TODO
 * @date 2023/4/25 22:35
 */
public class L2418 {
    public String[] sortPeople(String[] names, int[] heights) {
        TreeMap<Integer,Integer> map = new TreeMap<>((o1, o2) -> o2 - o1);
        for (int i = 0; i < heights.length; i++) {
            map.put(heights[i],i);
        }
        String[] ans = new String[names.length];
        int count = 0;
        for (Integer i : map.keySet()) {
            ans[count++] = names[map.get(i)];
        }
        return ans;
    }
}
